﻿using Manon.Autofac;
using Manon.ConfigCenter.Web.ApplicationCore.Dtos.Project;
using Manon.ConfigCenter.Web.ApplicationCore.Dtos.ProjectConfig;
using Manon.ConfigCenter.Web.ApplicationCore.Entities;
using Manon.Core.Commons;
using Manon.Repository.Collections;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Manon.ConfigCenter.Web.ApplicationCore.Interfaces
{
    public interface IProjectService : ISingletonDependency
    {


        /// <summary>
        /// 获取线上已经发布的配置
        /// </summary>
        /// <param name="ProjectId"></param>
        /// <param name="EnvId"></param>
        /// <returns></returns>
        Task<string> GetOnlineConfigById(int ProjectId, int EnvId);

        /// <summary>
        /// 获取所有项目简要信息列表 无需权限控制
        /// </summary>
        /// <returns></returns>
        Task<List<ProjectSimpleOutput>> GetAllProjectSimpleListAsync();

        /// <summary>
        /// 获取项目简要信息列表
        /// </summary>
        /// <returns></returns>
        Task<List<ProjectSimpleOutput>> GetProjectSimpleListAsync();

        Task<IPagedList<ProjectsOutput>> GetProjectPageListAsync(GetProjectListInput Input);

        Task<Result<ProjectsOutput>> SaveProject(SaveProjectInput Input);

        Task<Result> SetEnabled(SetEnabledInput Input);

        Task<ProjectsOutput> GetProject(int Id);

        Task<Result> SaveProjectSettings(SaveProjectSettingsInput Input);

        Task<ProjectConfigOutput> GetLastConfigSettings(GetLastConfigSettingsInput Input);


        Task<Result> SetConfigPass(SetConfigPassInput Input);


        Task<Result> SetConfigUnPass(SetConfigUnPassInput Input);

        Task<Result> PublishConfig(PublishConfigInput Input);

        Task<Result> FinishConfig(PublishConfigInput Input);

        Task<IPagedList<ProjectsConfigHistoryOutput>> GetProjectHistoryPageList(GetProjectHistoryPageListInput Input);


        Task<ProjectsConfigHistoryOutput> GetProjectHistoryById(int HistoryId);

        Task<IPagedList<GetProjectSecretPageListOutput>> GetProjectSecretPageListAsync(GetProjectSecretPageListInput Input);
        /// <summary>
        /// 生成密钥
        /// </summary>
        /// <param name="Input"></param>
        /// <returns></returns>
        Task<Result> CreateEnvProjectSecret(CreateEnvProjectSecretInput Input);

        Task<string> GetProjectOnlineConfigById(string ProjectCode, string EnvCode);

        Task<GetProjectEnvSecretOutput> GetProjectEnvSecret(string ProjectCode, string EnvCode);
    }
}
